CO1301: Games ts 2015 Lecture 6 Vectors Dr Nick Mitchell (Room CM 224)

Slides:



Advertisements
Similar presentations
Chapter 3 Vectors.
Advertisements

Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
Chapter 3: VECTORS 3-2 Vectors and Scalars 3-2 Vectors and Scalars
Vector Operation and Force Analysis
Chapter 3 Vectors.
Vectors. Vectors and Direction Vectors are quantities that have a size and a direction. Vectors are quantities that have a size and a direction. A quantity.
Introduction and Vectors
Chapter 3, Vectors. Outline Two Dimensional Vectors –Magnitude –Direction Vector Operations –Equality of vectors –Vector addition –Scalar product of two.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Chapter 3 Vectors and Two-Dimensional Motion Vectors and Scalars A scalar is a quantity that is completely specified by a positive or negative number.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Chapter 3 – Two Dimensional Motion and Vectors
Kinematics and Dynamics
Engineering Mechanics: Statics Chapter 2: Force Vectors Chapter 2: Force Vectors.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
Vector components and motion. There are many different variables that are important in physics. These variables are either vectors or scalars. What makes.
Chapter 3 Vectors. Vector quantities  Physical quantities that have both numerical and directional properties Mathematical operations of vectors in this.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
34. Vectors. Essential Question What is a vector and how do you combine them?
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
VECTORS. BIG IDEA: Horizontal and vertical motions of an object are independent of one another.
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.
Vectors and Vector Addition. Vectors vs. Scalars Scalars are physical quantities having only magnitude– that is, a numerical value & units. Ex: a speed.
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.
PDT 180 ENGINEERING SCIENCE Vectors And Scalars MUNIRA MOHAMED NAZARI SCHOOL OF BIOPROCESS ENGINEERING UNIMAP.
Chapter 3 Vectors. Vector quantities  Physical quantities that have both numerical and directional properties Mathematical operations of vectors in this.
Chapter 4: How do we describe Vectors, Force and Motion? Objectives 4 To note that energy is often associated with matter in motion and that motion is.
Computational Geometry
What is wrong with the following statement?
Vectors AP Physics C.
Scalars and Vectors AS Level Physics 2016/5
Properties of Arithmetic
Vectors and Scalars AP Physics.
Vectors and Scalars This is longer than one class period. Try to start during trig day.
Chapter 4 Pg Vector Addition.
Chapter 1 Vectors.
Lecture Outline Chapter 3
Chapter 3 Kinetics in Two or Three Dimensions, Vectors (1 week)
4.1 Vectors in Physics Objective: Students will know how to resolve 2-Dimensional Vectors from the Magnitude and Direction of a Vector into their Components/Parts.
Vectors.
Chapter 3 Vectors September 17, 2018 Chap 3.
1.3 Vectors and Scalars Scalar: shows magnitude
7.1 Vectors and Direction 1.
Chapter 3: Vectors.
Lecture #2 (ref Ch 2) Vector Operation and Force Analysis 1 R. Michael PE 8/14/2012.
Math 200 Week 1- Wednesday Vectors.
Chapter 3: Vectors Reading assignment: Chapter 3
Chapter 3 Vectors.
Introduction and Mathematical Concepts
Chapter 3 Vectors.
SCI340_L05 _vectors.ppt More math concepts
Vectors More math concepts.
Scalars vs Vectors Scalars – a quantity that only needs a magnitude (with a unit) to describe it Ex: time, distance, speed, mass, volume, temperature Vectors.
Physics Ch.3 Vectors.
Adding Vectors Graphically
Ch. 3: Kinematics in 2 or 3 Dimensions; Vectors
Kinematics & Dynamics in 2 & 3 Dimensions; Vectors
Chapter 3 - Vectors I. Definition
Introduction and Mathematical Concepts
Pythagoras' Theorem.
Vectors & Equilibrium Sara sultan 07/04/2019.
Scalars vs Vectors Scalars – a quantity that only needs a magnitude (with a unit) to describe it Ex: time, distance, speed, mass, volume, temperature Vectors.
CO Games Concepts Week 12 Collision Detection
Week 2 Vectors in Physics.
Mathematics Vectors a b c LabRat Scientific © 2019.

Or What’s Our Vector Victor?
Presentation transcript:

CO1301: Games ts 2015 Lecture 6 Vectors Dr Nick Mitchell (Room CM 224) email: npmitchell@uclan.ac.uk Material originally prepared by Gareth Bellaby

Essential Reading on Vectors Rabin, Introduction to Game Development: 4.1: "Mathematical Concepts" Van Verthe, Essential Mathematics for Games: Chapter 2: "Vectors and Points"

Lecture Outline Maths Preliminaries Coordinates Vectors Vector arithmetic Vector length The direction vector and scalars

Topic 1: Some Maths Preliminaries

Order of precedence Mathematical operations have an order of precedence. Multiplication and division have equal precedence. Multiplication and division are always carried out before addition and subtraction. ? ? ? ?

Right-angled triangles Pythagoras’ Theorem With a right-angled triangle the length of the longest side (called the hypotenuse) is equal to the square root of the sum of the squares of the other two sides.

Right-angled triangles

Topic 2: Coordinates

Coordinates A coordinate represents a point in space. A point in 2D is represented using coordinates (x, y) In 3D it is represented using coordinates (x, y, z) The convention is: use round brackets a comma separated list, e.g. ( 2, 4, 7 ) always in the sequence: x, y, z. Called Cartesian geometry after Rene Descartes.

Coordinates We use a 3D grid to identify points in space. Can choose the direction to point Z. Use your hand to indicate the geometry. This gives the "handedness" of the geometry. In the TL-Engine we are using left-handed axes. Z Y X is thumb Y index finger Z middle finger X

Coordinates Y Z Z Y X X The origin of the grid is at ( 0, 0, 0 )

Topic 3: Vectors

Vectors We often need to identify a movement or direction in 3D - this can also be represented using values (x, y, z) and is called a vector. Vectors are more easily shown in 2D using where we only need (x, y) values.

Vector between two points Calculated by subtracting one point from the other. Subtract: the x values to produce one new x; the y values to produce a new y; and then the z values to produce a new z. The vector V from P1(x1, y1) to P2(x2, y2) is: V( x2 - x1, y2 - y1) Sometimes written P1 P2 Note that P1 is subtracted from P2

Vectors The arrow of movement from P1 to P2 can be represented as the vector V(20,10). V( x2 - x1, y2 - y1) = (30, 30) - (10, 20) = (20, 10) The vector V from point P1(x1, y1) to P2(x2, y2) is ?

Vector between two points Notice how the values in the vector are found by subtracting the source point coordinates from the destination point coordinates. This means that the direction of the vector is important: the vector in the reverse direction, from P2 to P1, is… (10, 20) - (30, 30) = (-20, -10) ?

Vectors 2D extends simply to 3D. The vector V from point P1(x1, y1, z1) to P2(x2, y2, z2) is V( x2 - x1, y2 - y1, z2 - z1) Points and vectors are represented in the same way. A vector can be directly applied to a point. Location and movement can all be considered to be the same thing. A point is represented by P(x, y, z) A vector is represented by V(x, y, z) A vector of force is represented in the same way e.g. the effect of wind.

Vectors The line between two points is the path you need to take to travel directly from one point to another. The vector is the same no matter what its coordinates are. At the origin this is obviously true. But you can also see this will be true wherever the points are: you can move the vector over the grid and it stays the same.

Vector direction Which point is subtracted from which is important. The order gives us the direction of movement. P1(1, 1) to P2 (3, 3) =(3 - 1, 3 - 1) = (2, 2) P2(3, 3) to P1 (1, 1) = (1 - 3, 1 - 3) = (-2, -2)

Vector direction If you ever need a reminder about the order when calculating the vector between two points just think about the direction of the movement. Easiest to do this if you imagine one of the points being at the origin. From (0, 0, 0) to (2, 2, 0) = ( 2 - 0, 2 - 0, 0 - 0) = ( 2, 2, 0 ) Upwards and to the right From (2, 2, 0) to (0, 0, 0) = ( 0 - 2, 0 - 2, 0 - 0) = ( -2,- 2, 0 ) Downwards and to the left

Topic 4: Vector Arithmetic

Vector Addition We visualise vectors by drawing a line with an arrowhead at one end. Two vectors V and W are added by placing the beginning of W at the end of V.

Vector Addition V(1, 3) + W(3, 1) = (4, 4) ?

Vector Subtraction ? Subtraction works in the same way as addition. The direction in which the subtracted vector points is effectively reversed. V(1, 3) - W(3, 1) = (-2, 2) ?

Vector Arithmetic The order of operations is irrelevant. V + W = W + V

Topic 5: Vector Length

Length of a vector If we have a vector V(x, y, z) then we can use Pythagoras’ Theorem to show that:

Length of a vector Easiest with a 2D example. A vector makes a right-angled triangle. The shortest sides of the triangle are the x and y values. 3D is exactly the same - but with the addition of tee z axis.

Maths symbol for length The length of a vector v(x, y, z) is given by:

Topic 6: The direction vector and scalars

Direction of movement The direction between two points is only partly useful. The problem is that its size depends on the distance between the two points. Both vectors are pointing in the same direction, but the black vector is half the size of the red vector

Direction of movement As you know, the units we use within 3D graphics are arbitrary. Sometimes in the TL-Engine a distance of 0.1 is large, sometimes it is small. It all depends on the scale of the models. Direction should be independent of scale. The direction vector is a vector which is independent of scale. The direction vector has a length of 1. A vector whose length is 1 is said to be normalised.

The direction vector The direction vector is found by: Calculating the length of the vector Dividing each component of the vector by its length For example, given a vector V( 1, 3, 6 ) length direction vector

The direction vector Here is a 2D example of the process: length

3D example Vector pointing straight forward: ( 0, 0, 7.5 ) length length direction vector direction vector

"Pointing at" or "Looking at" Vectors can be used to represent a direction (in the sense of North or North-West). To do this we create a vector that ‘points’ in the direction we want, and has a length of 1 unit. We often need to find the direction vector that ‘points’ from one position to another. The process we use is: Get the vector between the two positions V(x, y, z) Find the length of this vector l (using pythagoras) The direction vector is VDir (x / l, y / l, z / l)

Maths for normalised vector A normal is any vector whose length is 1 Represented with a ^ symbol: A vector is converted to a normal (normalised) by dividing the components by the length:

Scalar Direction vectors are always length 1. They are always the unit length. In order to describe an actual movement you combine the direction vector with a scalar. The scalar is the distance to be moved. Imagine that you want to move something by a given distance in a particular direction. We multiply the direction vector by the distance we want to move. For example, move the normalised vector ( 2, 4, 5 ) by 12 units results in ( 24, 48, 60 )

Scalar A normalised vector can be seen as the direction of a vector A vector can be broken up into normalised vector and length, e.g. Movement = Normalised vector * distance Velocity = Normalised vector * speed The scalar changes the magnitude of a vector. The root word is "scale". The operation of the scalar is to scale the vector. This also reminds us why normalised vectors are useful.