Chapter 2: Vectors Ian Parberry University of North Texas Fletcher Dunn Valve Software 3D Math Primer for Graphics and Game Development.

Slides:



Advertisements
Similar presentations
Vectors and Two-Dimensional Motion
Advertisements

Vectors Lesson 4.3.
Chapter 1: Cartesian Coordinate Systems
General Physics (PHYS101)
12 VECTORS AND THE GEOMETRY OF SPACE.
Chapter 7: Vectors and the Geometry of Space
Math Review Guest Lecturer: Michiel van de Panne Week 1, Wed Jan 9
Chapter 3 Vectors.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CSC 123 – Computational Art Points and Vectors
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Vectors and Scalars Vector and scalar quantities Adding vectors geometrically Components Unit Vectors Dot Products Cross Products pps by C Gliniewicz.
Chapter 3: VECTORS 3-2 Vectors and Scalars 3-2 Vectors and Scalars
Vector Operation and Force Analysis
VECTORS AND THE GEOMETRY OF SPACE Vectors VECTORS AND THE GEOMETRY OF SPACE In this section, we will learn about: Vectors and their applications.
Scalar and Vector Fields
Copyright © Cengage Learning. All rights reserved.
1 Vectors and Two-Dimensional Motion. 2 Vector Notation When handwritten, use an arrow: When handwritten, use an arrow: When printed, will be in bold.
Vectors and Two-Dimensional Motion
Chapter 3 Vectors.
Ch. 3, Kinematics in 2 Dimensions; Vectors. Vectors General discussion. Vector  A quantity with magnitude & direction. Scalar  A quantity with magnitude.
Phys211C1V p1 Vectors Scalars: a physical quantity described by a single number Vector: a physical quantity which has a magnitude (size) and direction.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Vectors. Definitions Scalar – magnitude only Vector – magnitude and direction I am traveling at 65 mph – speed is a scalar. It has magnitude but no direction.
Copyright © Cengage Learning. All rights reserved.
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Chapter 4.1 Mathematical Concepts
Review of Vector Analysis
Vectors A vector is a quantity that is characterized by both magnitude and direction. Vectors are represented by arrows. The length of the arrow represents.
Section 13.4 The Cross Product. Torque Torque is a measure of how much a force acting on an object causes that object to rotate –The object rotates around.
Chapter 3 Vectors and Two-Dimensional Motion. Vector vs. Scalar Review All physical quantities encountered in this text will be either a scalar or a vector.
CSCE 552 Spring 2011 Math By Jijun Tang. Layered.
H.Melikyan/12001 Vectors Dr.Hayk Melikyan Departmen of Mathematics and CS
Chapter 3 Vectors. Coordinate Systems Used to describe the position of a point in space Coordinate system consists of a fixed reference point called the.
Introduction to Vectors
In this chapter we will learn about vectors.  properties, addition, components of vectors When you see a vector, think components! Multiplication of vectors.
Vectors What is Vector?  In elementary mathematics, physics, and engineering, a Euclidean vector is a geometric object that has both a magnitude (or length)
Chapter 3 Vectors and Two-Dimensional Motion. Vector Notation When handwritten, use an arrow: When handwritten, use an arrow: When printed, will be in.
Chapter 3 Vectors. Coordinate Systems Used to describe the position of a point in space Coordinate system consists of a fixed reference point called the.
Presented by: S. K. Pandey PGT Physics K. V. Khandwa Kinematics Vectors.
Copyright © Cengage Learning. All rights reserved. 12 Vectors and the Geometry of Space.
Chapter 3 Vectors. Vector quantities  Physical quantities that have both numerical and directional properties Mathematical operations of vectors in this.
Chapter 3 Vectors. Coordinate Systems Used to describe the ___________of a point in space Coordinate system consists of – A fixed _____________point called.
Chapter 3 Vectors. Vectors – physical quantities having both magnitude and direction Vectors are labeled either a or Vector magnitude is labeled either.
Vectors and the Geometry
VECTORS AND THE GEOMETRY OF SPACE. The Cross Product In this section, we will learn about: Cross products of vectors and their applications. VECTORS AND.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Math Basics Week 1, Fri.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Math Review Week 1, Fri.
Chapter 3 Lecture 5: Vectors HW1 (problems): 1.18, 1.27, 2.11, 2.17, 2.21, 2.35, 2.51, 2.67 Due Thursday, Feb. 11.
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
Vectors in the Plane 8.3 Part 1. 2  Write vectors as linear combinations of unit vectors.  Find the direction angles of vectors.  Use vectors to model.
Chapter 3 Vectors. Vector quantities  Physical quantities that have both numerical and directional properties Mathematical operations of vectors in this.
Vectors Lesson 4.3.
Outline Addition and subtraction of vectors Vector decomposition
Chapter 3 Vectors September 17, 2018 Chap 3.
Lecture #2 (ref Ch 2) Vector Operation and Force Analysis 1 R. Michael PE 8/14/2012.
Lecture 03: Linear Algebra
Chapter 3 Vectors.
Chapter 3 Vectors.
Chapter Vectors.
Copyright © Cengage Learning. All rights reserved.
Vectors.
Game Programming Algorithms and Techniques
CHAPTER 3 VECTORS NHAA/IMK/UNIMAP.
Presentation transcript:

Chapter 2: Vectors Ian Parberry University of North Texas Fletcher Dunn Valve Software 3D Math Primer for Graphics and Game Development

What You’ll See in This Chapter This chapter is about vectors. It is divided into thirteen sections. Section 2.1 covers some of the basic mathematical properties of vectors. Section 2.2 gives a high-level introduction to the geometric properties of vectors. Section 2.3 connects the mathematical definition with the geometric one, and discusses how vectors work within the framework of Cartesian coordinates. Section 2.4 discusses the often confusing relationship between points and vectors and considers the rather philosophical question of why it is so hard to make absolute measurements. Sections 2.5–2.12 discuss the fundamental calculations we can perform with vectors, considering both the algebra and geometric interpretation of each operation. Section 2.13 presents a list of helpful vector algebra laws. Chapter 2 Notes3D Math Primer for Graphics & Game Dev2

Word Cloud Chapter 2 Notes3D Math Primer for Graphics & Game Dev3

Section 2.1: Mathematical Definition and Other Boring Stuff Chapter 2 Notes3D Math Primer for Graphics & Game Dev4

Vectors and Scalars An “ordinary number” is called a scalar. Algebraic definition of a vector: a list of scalars in square brackets. Eg. [1, 2, 3]. Vector dimension is the number of numbers in the list (3 in that example). Typically we use dimension 2 for 2D work, dimension 3 for 3D work. We’ll find a use for dimension 4 also, later. Chapter 2 Notes3D Math Primer for Graphics & Game Dev5

Row vs. Column Vectors Vectors can be written in one of two different ways: horizontally or vertically. Row vector: [1, 2, 3] Column vector: Chapter 2 Notes3D Math Primer for Graphics & Game Dev6

More on Row vs. Column Mathematicians use row vectors because they’re easier to write and take up less space. For now it doesn’t really matter which convention you use. Much. More on that later. Chapter 2 Notes3D Math Primer for Graphics & Game Dev7

Our Notation Bold case letters for vectors eg. v. Scalar parts of a vector are called components. Use subscripts for components. Eg. If v = [6, 19, 42], its components are v 1 = 6, v 2 = 19, v 3 = 42. Chapter 2 Notes3D Math Primer for Graphics & Game Dev8

More Notation Can also use x, y, z for subscripts. 2D vectors: [v x, v y ]. 3D vectors: [v x, v y, v z ]. 4D vectors [v x, v y, v z, v w ]. (We’ll get to w later.) Chapter 2 Notes3D Math Primer for Graphics & Game Dev9

Even More Notation Scalar variables will be represented by lowercase Roman or Greek letters in italics: a, b, x, y, z, θ, α, ω, γ. Vector variables of any dimension will be represented by lowercase letters in boldface: a, b, u, v, q, r. Matrix variables will be represented using uppercase letters in boldface: A, B, M, R. Chapter 2 Notes3D Math Primer for Graphics & Game Dev10

Terminology Displacement is a vector (eg. 10 miles West) Distance is a scalar (eg. 10 miles away) Velocity is a vector (eg. 55mph North) Speed is a scalar (eg. 55mph) Vectors are used to express relative things. Scalars are used to express absolute things. Chapter 2 Notes3D Math Primer for Graphics & Game Dev11

Section 2.2: Geometric Definition Chapter 2 Notes3D Math Primer for Graphics & Game Dev12

Geometric Definition of Vector A vector consists of a magnitude and a direction. Magnitude = size. Direction = orientation. Draw it as an arrow. Chapter 2 Notes3D Math Primer for Graphics & Game Dev13

Which End is Which? Chapter 2 Notes3D Math Primer for Graphics & Game Dev14

Terminology Displacement is a vector (eg. 10 miles West) Distance is a scalar (eg. 10 miles away) Velocity is a vector (eg. 55mph North) Speed is a scalar (eg. 55mph) Vectors are used to express relative things. Scalars are used to express absolute things. Chapter 2 Notes3D Math Primer for Graphics & Game Dev15

Section 2.3: Specifying Vectors Using Cartesian Coordinates Chapter 2 Notes3D Math Primer for Graphics & Game Dev16

Chapter 2 Notes3D Math Primer for Graphics & Game Dev17

Chapter 2 Notes3D Math Primer for Graphics & Game Dev18

Chapter 2 Notes3D Math Primer for Graphics & Game Dev19

The Zero Vector The zero vector 0 is the additive identity, meaning that for all vectors v, v + 0 = 0 + v = v. 0 = [0, 0,…, 0] The zero vector is unique: It’s the only vector that doesn’t have a direction Chapter 2 Notes3D Math Primer for Graphics & Game Dev20

Section 2.4: Vectors vs Points Chapter 2 Notes3D Math Primer for Graphics & Game Dev21

Vectors vs Points Points are measured relative to the origin. Vectors are intrinsically relative to everything. So a vector can be used to represent a point. The point (x,y) is the point at the head of the vector [x,y] when its tail is placed at the origin. But vectors don’t have a location Chapter 2 Notes3D Math Primer for Graphics & Game Dev22

Chapter 2 Notes3D Math Primer for Graphics & Game Dev23

Chapter 2 Notes3D Math Primer for Graphics & Game Dev24

Key Things to Remember Vectors don’t have a location. They can be dragged around the world whenever it’s convenient. We will be doing that a lot. It’s tempting to think of them with tail at the origin. We can but don’t have to. Be flexible. Chapter 2 Notes3D Math Primer for Graphics & Game Dev25

Sections : Vector Operations Chapter 2 Notes3D Math Primer for Graphics & Game Dev26

Next: Vector Operations Negation Multiplication by a scalar Addition and Subtraction Displacement Magnitude Normalization Dot product Cross product Chapter 2 Notes3D Math Primer for Graphics & Game Dev27

René Descartes Remember René Descartes from Chapter 1? He’s famous for (among other things) unifying algebra and geometry. His observation that algebra and geometry are the same thing is particularly significant for us, because algebra is what we program, and geometry is what we see on the screen. Chapter 2 Notes3D Math Primer for Graphics & Game Dev28

René Descartes Our approach to vector operations would have pleased him. We will describe both the algebra and the geometry behind vector operations. Let’s get started… Chapter 2 Notes3D Math Primer for Graphics & Game Dev29

Section 2.5: Negating a Vector Chapter 2 Notes3D Math Primer for Graphics & Game Dev30

Vector Negation: Algebra Negation is the additive inverse: v + -v = -v + v = 0 To negate a vector, negate all of its components. Chapter 2 Notes3D Math Primer for Graphics & Game Dev31

Examples Chapter 2 Notes3D Math Primer for Graphics & Game Dev32

Vector Negation: Geometry To negate a vector, make it point in the opposite direction. Swap the head with the tail, that is. A vector and its negative are parallel and have the same magnitude, but point in opposite directions. Chapter 2 Notes3D Math Primer for Graphics & Game Dev33

Chapter 2 Notes3D Math Primer for Graphics & Game Dev34

Section 2.6: Vector Multiplication by a Scalar Chapter 2 Notes3D Math Primer for Graphics & Game Dev35

Vector Mult. by a Scalar: Algebra Can multiply a vector by a scalar. Result is a vector of the same dimension. To multiply a vector by a scalar, multiply each component by the scalar. For example, if ka = b, then b 1 =ka 1, etc. So vector negation is the same as multiplying by the scalar –1. Division by a scalar same as multiplication by the scalar multiplicative inverse. Chapter 2 Notes3D Math Primer for Graphics & Game Dev36

Chapter 2 Notes3D Math Primer for Graphics & Game Dev37

Vector Mult. by a Scalar: Geometry Multiplication of a vector v by a scalar k stretches v by a factor of k In the same direction if k is positive. In the opposite direction if k is negative. To see this, think about the Pythagorean Theorem. Chapter 2 Notes3D Math Primer for Graphics & Game Dev38

Chapter 2 Notes3D Math Primer for Graphics & Game Dev39

Section 2.7: Vector Addition and Subtraction Chapter 2 Notes3D Math Primer for Graphics & Game Dev40

Vector Addition: Algebra Can add two vectors of the same dimension. Result is a vector of the same dimension. To add two vectors, add their components. For example, if a + b = c, then c 1 = a 1 + b 1, etc. Subtract vectors by adding the negative of the second vector, so a – b = a + (– b) Chapter 2 Notes3D Math Primer for Graphics & Game Dev41

Vector Addition: Algebra Chapter 2 Notes3D Math Primer for Graphics & Game Dev42

Vector Subtraction: Algebra Chapter 2 Notes3D Math Primer for Graphics & Game Dev43

Algebraic Identities Vector addition is associative. a + (b + c) = (a + b) + c Vector addition is commutative. a + b = b + a Vector subtraction is anti-commutative. a – b = –(b – a) Chapter 2 Notes3D Math Primer for Graphics & Game Dev44

Vector Addition: Geometry To add vectors a and b: use the triangle rule. Place the tail of a on the head of b. a + b is the vector from the tail of b to the head of a. Or the other way around: we can swap the roles of a and b (because vector addition is commutative, remember the algebra.) Chapter 2 Notes3D Math Primer for Graphics & Game Dev45

Triangle Rule for Addition Chapter 2 Notes3D Math Primer for Graphics & Game Dev46 Algebra: [4, 1] + [-2, 3] = [2, 4] Geometry:

Triangle Rule for Subtraction Place c and d tail to tail. c – d is the vector from the head of d to the head of c (head-positive, tail-negative). Chapter 2 Notes3D Math Primer for Graphics & Game Dev47

Chapter 2 Notes3D Math Primer for Graphics & Game Dev48

Chapter 2 Notes3D Math Primer for Graphics & Game Dev49

Adding Many Vectors Repeat the triangle rule as many times as necessary? Result: string all the vectors together. (Should we call this the polygon rule or the multitriangle rule?) Chapter 2 Notes3D Math Primer for Graphics & Game Dev50

Chapter 2 Notes3D Math Primer for Graphics & Game Dev51

Vector Displacement: Algebra Here’s how to get the vector displacement from point a to point b. Let a and b be the vectors from the origin to the respective points. The vector from a to b is b – a (the destination is positive) Chapter 2 Notes3D Math Primer for Graphics & Game Dev52

Vector Displacement: Geometry Chapter 2 Notes3D Math Primer for Graphics & Game Dev53

Section 2.8: Vector Magnitude Chapter 2 Notes3D Math Primer for Graphics & Game Dev54

Vector Magnitude: Algebra Chapter 2 Notes3D Math Primer for Graphics & Game Dev55 The magnitude of a vector is a scalar. Also called the “norm”. It is always positive

Vector Magnitude: Geometry Magnitude of a vector is its length. Use the Pythagorean theorem. In the next slide, two vertical lines ||v|| means “magnitude of a vector v”, one vertical line |v x | means “absolute value of a scalar v x ” Chapter 2 Notes3D Math Primer for Graphics & Game Dev56

Chapter 2 Notes3D Math Primer for Graphics & Game Dev57

Observations The zero vector has zero magnitude. There are an infinite number of vectors of each magnitude (except zero). Chapter 2 Notes3D Math Primer for Graphics & Game Dev58

Section 2.9: Unit Vectors Chapter 2 Notes3D Math Primer for Graphics & Game Dev59

Normalization: Algebra A normalized vector always has unit length. To normalize a nonzero vector, divide by its magnitude. Chapter 2 Notes3D Math Primer for Graphics & Game Dev60

Example Normalize [12, -5]: Chapter 2 Notes3D Math Primer for Graphics & Game Dev61

Normalization: Geometry Chapter 2 Notes3D Math Primer for Graphics & Game Dev62

Section 2.10: The Distance Formula Chapter 2 Notes3D Math Primer for Graphics & Game Dev63

Application: Computing Distance To find the geometric distance between two points a and b. Compute the vector d from a to b. Compute the magnitude of d. We know how to do both of those things. Chapter 2 Notes3D Math Primer for Graphics & Game Dev64

Section 2.11: Vector Dot Product Chapter 2 Notes3D Math Primer for Graphics & Game Dev65

Dot Product: Algebra Can take the dot product of two vectors of the same dimension. The result is a scalar. Chapter 2 Notes3D Math Primer for Graphics & Game Dev66

Dot Product: Geometry Dot product is the magnitude of the projection of one vector onto another. Chapter 2 Notes3D Math Primer for Graphics & Game Dev67

Sign of Dot Product Chapter 2 Notes3D Math Primer for Graphics & Game Dev68

Dot Product: Geometry Chapter 2 Notes3D Math Primer for Graphics & Game Dev69

Sign of Dot Product Chapter 2 Notes3D Math Primer for Graphics & Game Dev70

Section 2.12: Vector Cross Product Chapter 2 Notes3D Math Primer for Graphics & Game Dev71

Cross Product: Algebra Can take the cross product of two vectors of the same dimension. Result is a vector of the same dimension. Chapter 2 Notes3D Math Primer for Graphics & Game Dev72

Cross Pattern Chapter 2 Notes3D Math Primer for Graphics & Game Dev73

Cross Product: Geometry Given 2 nonzero vectors a, b. They are (must be) coplanar. The cross product of a and b is a vector perpendicular to the plane of a and b. The magnitude is related to the magnitude of a and b and the angle between a and b. The magnitude is equal to the area of a parallelogram with sides a and b. Chapter 2 Notes3D Math Primer for Graphics & Game Dev74

Chapter 2 Notes3D Math Primer for Graphics & Game Dev75

Chapter 2 Notes3D Math Primer for Graphics & Game Dev76 Area of this parallellogram is ||b|| h

Aside: Here’s Why Chapter 2 Notes3D Math Primer for Graphics & Game Dev77

Catch Your Breath Are you OK with the fact that the area of a parallelogram is its base times its height measured perpendicularly to the base? Now we’ll show that the area is Chapter 2 Notes3D Math Primer for Graphics & Game Dev78

Chapter 2 Notes3D Math Primer for Graphics & Game Dev79

What About the Orientation? That’s taken care of the magnitude. Now for the direction. Does the vector a x b point up or down from the plane of a and b? Place the tail of b at the head of a. Look at whether the angle from a to b is clockwise or counterclockwise. The result depends on whether coordinate system is left- or right-handed. Chapter 2 Notes3D Math Primer for Graphics & Game Dev80

Chapter 2 Notes3D Math Primer for Graphics & Game Dev81

Chapter 2 Notes3D Math Primer for Graphics & Game Dev82 In a left-handed coordinate system, use your left hand. Curl fingers in direction of vectors Thumb points in direction of a x b

Chapter 2 Notes3D Math Primer for Graphics & Game Dev83

Chapter 2 Notes3D Math Primer for Graphics & Game Dev84 In a right-handed coordinate system, use your right hand Curl fingers in direction of vectors Thumb points in direction of a x b

Corollary In a left-handed coordinate system, list your triangles in clockwise order. Then you can compute a surface normal (a unit vector pointing out from the face of the triangle) by taking the cross product of two consecutive edges. Chapter 2 Notes3D Math Primer for Graphics & Game Dev85

Computing a Surface Normal Given a triangle with points a, b, c. Compute the vector displacement from a to b, and the vector from b to c. Take their cross product. Normalize the resulting surface normal. WARNING: some modeling programs may output zero-width triangles: these have a zero cross product. Don’t normalize it. Chapter 2 Notes3D Math Primer for Graphics & Game Dev86

Facts About Dot and Cross Product If a.b = 0, then a is perpendicular to b. If a x b = 0, then a is parallel to b. Dot product interprets every vector as being perpendicular to 0. Cross product interprets every vector as being parallel to 0. Neither is really the case, but both are a convenient fiction. Chapter 2 Notes3D Math Primer for Graphics & Game Dev87

Section 2.13: Linear Algebra Identities Chapter 2 Notes3D Math Primer for Graphics & Game Dev88

Chapter 2 Notes3D Math Primer for Graphics & Game Dev89

That concludes Chapter 2. Next, Chapter 3: Multiple Coordinate Spaces Chapter 2 Notes3D Math Primer for Graphics & Game Dev90