Math / Physics 101 GAM 376 Robin Burke Fall 2006.

Slides:



Advertisements
Similar presentations
Kinematics The branch of mechanics that studies the motion of a body without caring about what caused the motion.
Advertisements

COMP Robotics: An Introduction
Motion in 2D o Vectors o Projectile Motion Physics -101 Piri Reis University 2010.
Chapter 2: Describing Motion in 1-D
KINEMATICS.
MOMENTUM AND COLLISIONS
Chapter 12: Momentum 12.1 Momentum
Mathematics Algebra 1 Trigonometry Geometry The Meaning of Numbers Choosing the Correct Equation(s) Trig and Geometry Mathematics is a language. It is.
3. Motion in Two and Three Dimensions
Math / Physics 101 GAM 376 Robin Burke Winter 2008.
Vectors and Two Dimensional Motion
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
1 Geometry A line in 3D space is represented by  S is a point on the line, and V is the direction along which the line runs  Any point P on the line.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Physics of Rolling Ball Coasters
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Halliday/Resnick/Walker Fundamentals of Physics 8th edition
Mathematical Fundamentals
Game Physics – Part IV Moving to 3D
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Scalars and Vectors Scalars are quantities that are fully described by a magnitude (or numerical value) alone. Vectors are quantities that are fully described.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Chapter 10 Rotation of a Rigid Object about a Fixed Axis.
CSCE 552 Spring 2011 Math By Jijun Tang. Layered.
Vectors and Vector Multiplication. Vector quantities are those that have magnitude and direction, such as: Displacement,  x or Velocity, Acceleration,
Mechanics Unit 5: Motion and Forces 5.6 Motion in one Dimension - Speed and Velocity, Acceleration...
Period 1 Pg Ques: 27, 33, 36, 56, 58a, 60-62, 66, 68b.
1 Momentum and Its Conservation Or How I Learned to Love Collisions.
Ch. 2: Describing Motion: Kinematics in One Dimension.
Chapter 2, Kinematics. Terminology Mechanics = Study of objects in motion. –2 parts to mechanics. Kinematics = Description of HOW objects move. –Chapters.
Wednesday, Sept. 8, 2004PHYS , Fall 2004 Dr. Jaehoon Yu 1 PHYS 1443 – Section 003 Lecture #5 Wednesday, Sept. 8, 2004 Dr. Jaehoon Yu 1.One Dimensional.
Chapter 3 Kinematics in Two Dimensions; Vectors. Units of Chapter 3 Vectors and Scalars Addition of Vectors – Graphical Methods Subtraction of Vectors,
Chapter C2 Vectors Fall 2008 Problems C2B.1, B2, B4, B7, B8, B9, C2S.1 Due Thursday.
Ch. 2: Describing Motion: Kinematics in One Dimension.
Mechanics 105 Standards Dimensional analysis Unit conversions Order of magnitude calculations/estimation Significant figures Coordinates Vectors and scalars.
PHYS 1441 – Section 002 Lecture #8 Monday, Feb. 11, 2013 Dr. Jaehoon Yu Maximum Range and Height What is the Force? Newton’s Second Law Free Body Diagram.
Chapter 3 : Motion Weerachai Siripunvaraporn Department of Physics, Faculty of Science Mahidol University &msn :
CGDD 4003 THE MATH LECTURE (BOILED DOWN, YET LIGHTLY SALTED)
Kinematics in Two Dimensions AP Physics 1. Cartesian Coordinates When we describe motion, we commonly use the Cartesian plane in order to identify an.
Chapter 1-3 Outline. Chapter 1 Introduction, Measurement, Estimating.
1 Do Now: What makes the shuttle go UP? Objectives: Utilize IMPULSE to calculate: Force – time – change in velocity Home work: Page 233: #’s 1 – 5 all.
Mechanical Rate (a.k.a. Motion)
MOTION IN ONE DIMENSION AVERAGE / INSTANTANEOUS SPEED POSITION AND DISPLACEMENT AVERAGE / INSTANTANEOUS VELOCITY AVERAGE / INSTANTANEOUS ACCELERATION.
Momentum.
Describing Motion Physics 11. Cartesian Coordinates When we describe motion, we commonly use the Cartesian plane in order to identify an object’s position.
POSITION AND COORDINATES l to specify a position, need: reference point (“origin”) O, distance from origin direction from origin (to define direction,
Linear Momentum. 5-1 Linear Momentum Linear Momentum, p – defined as mass x velocity The unit is kgm/s A quantity used in collisions So a small object.
Chapter 1. Concepts of Motion
Circular Motion and Other Applications of Newton’s Laws
Kinematics The branch of mechanics that studies the motion of a body without caring about what caused the motion.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Rick Parent - CIS682 Rigid Body Dynamics simulate basic physics of an object subject to forces Keyframing can be tedious - especially to get ‘realism’
Monday, Sept. 20, 2010PHYS , Fall 2010 Dr. Jaehoon Yu 1 PHYS 1441 – Section 002 Lecture #5 Monday, Sept. 20, 2010 Dr. Jaehoon Yu One Dimensional.
1 Do Now: What makes the shuttle go UP? Objectives: Utilize IMPULSE to calculate: Force – time – change in velocity Home work: Page 233: #’s 1 – 5 all.
Kinematics. Kinematics-What is it? Kinematics is the study of motion. –Motion is always defined in terms of change in location.  Locations or Positions.
VECTORS. BIG IDEA: Horizontal and vertical motions of an object are independent of one another.
Chapter 3 Kinematics in More Dimensions; Vectors.
Wednesday, Feb. 4, 2004PHYS , Spring 2004 Dr. Jaehoon Yu 1 PHYS 1441 – Section 004 Lecture #5 Wednesday, Feb. 4, 2004 Dr. Jaehoon Yu Chapter two:
Consider Three Dimensions z y x a axax ayay azaz   xy Projection Polar Angle Azimuthal Angle.
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Mechanics The study of Physics begins with mechanics. Mechanics is the branch of physics that focuses on the motion of objects and the forces that cause.
Insanely Super Important Kinematics Terms. Kinematics The study of the motion of objects- does not deal with the forces that caused the motion.
Some Physics Quantities
PHYS 1441 – Section 002 Lecture #6
Lecture Rigid Body Dynamics.
Mechanics The study of Physics begins with mechanics.
Game Programming Algorithms and Techniques
Motion and Momentum S8P3: Students will investigate relationship between force, mass, and the motion of objects.
Presentation transcript:

Math / Physics 101 GAM 376 Robin Burke Fall 2006

Admin Lab

Begin math / physics 101 Vectors Coordinate spaces Kinematics

Vector A multi-dimensional quantity represented by a tuple of numbers We will deal mostly with 2-D vectors 3-D vectors are more mathematically complex but not fundamentally different for AI purposes

Vectors can represent positions is a position 1 unit north and 1 unit east of the origin can also represent velocities is a speed of 5 units in a northwesterly direction other quantities orientation, acceleration, angle, etc.

Vector operations Magnitude v = | v | = magnitude(v) = sqrt(x1 2 +y1 2 ) the length of the vector Adding + = Scalar multiplication * z = changes only the length Normalization v / |v| makes a vector of length 1 does not change the orientation of the vector

More vector operations dot product ● = x1 * x2 + y1 *y2 scalar quantity related to the angle between vectors cos (angle) = u ● v / | u | | v | Note if u and v are normalized (length = 1) then u ● v is the cosine of the angle between them

Example we have two agents: a, b each has a vector position and a normalized vector orientation the direction they are facing turn to face an enemy agent: P a, O a enemy: P b, O b vector from agent to enemy P ba = P b -P a normalize it compute dot product norm(P ba ) ● O a compute inverse cosine this is the angle to turn

Pa Pb Pb-Pa cos -1 (Oa norm(Pb-Pa))

Coordinate transformations We will always want to move back and forth between coordinate systems objects each have their own local coordinate systems related to each other in "world space" Example NPC a character is at a particular position, facing a particular direction he defines a coordinate system Door the door has its own coordinate system in that system, the handle is in a particular spot To make the character reach for the handle we have to make the two coordinate systems interact

Transformations We know where the handle is in door space where the agent's hand is in agent space what is the vector in agent space Set of transformations transform handle location L 0 to world space L w transform handle location to agent space L a Each transformation is a translation (changing the origin) and a rotation changing the orientation

Affine transformations Usually coordinate transformations are done through matrix multiplications we multiply a vector by a matrix and get another vector out The curious thing is that to do this we have to use vectors and matrices one size larger than our current number of dimensions you will see as the representation of 2-D vector and for 3-D

Example rotation around the origin by angle θ matrix multiply by current vector [1, 0] becomes ? answer x = cos(θ) – sin (θ) + 0 y = sin(θ) + cos(θ) + 0

x' = x cos(θ) – y sin(θ) y' = x sin(θ) + y cos(θ) (1, 2) θ = -π / 4 (2.12, 0.70)

Translation Achieved by adding values at the ends of the top two rows This rotates and translates by (3, -4)

Efficiency Mathematical operations are expensive especially trigonometric ones (inverse cosine) also square root multiplication and division, too Normalization is particularly expensive square root, squaring and division We want to consider ways to make our calculations faster especially if we are doing them a lot we can do calculations in "squared space" never have to do square roots

Kinematics the physics of motion we worry about this a lot in computer games moving through space, collisions, etc. our NPCs have to understand this too in order to not look stupid

Basic kinematics position a vector in space (point position) for a large object we use a convenient point classically the center of mass velocity the change of position over time expressed as a vector p t+1 = p t + vΔt if we define the time interval Δt to be 1 we avoid a multiplication

Basic kinematics II Acceleration change in velocity over time also expressed as a vector v t+1 = v t + a Δt Pair of difference equations

Numerical methods We want to run a simulation that shows what happens But now we have a problem there is a lag of 1 time step before acceleration impacts position not physically accurate Example deceleration to stop t = 0, d = 0, v = 10, a = 0 t = 1, d = 10, v = 10, a = -5 t = 2, d = 20, v = 5, a = -5 t = 3, d = 25, v = 0, a = 0 Correct distance traveled Δd = v 0 Δt + ½ a Δt 2 Δd = 10 d = 20

We can improve our simulation finer time step (very expensive) improved estimation methods for example instead of using v t, we can use the average of v t and v t+1 Example t=0, d=0, v=10, a =0 t=1, d=10, v=10, a = -5 t=2, d=17.5, v=5, a=-5 t=3, d=20, v=0, a=0 better we slow down in the first time step correct final answer but only works if acceleration is constant take GAM 350 for better ways

What does this have to do with AI? Imagine a NPC baseball player he has to decide when to swing that judgment has to be based on an estimate of the ball's trajectory When NPC take physical actions we have to know what the parameters of those actions should be very often physics calculations are required not as detailed as the calculations needed to run the game

Approximation in Prediction NPC will frequently need to predict the future where will the player be by the time my rocket gets there? Assumptions current velocity stays constant we know the speed of the rocket Correct way vector algebra lots of square roots and trig functions Typical approximation use the current distance won't change that much if the rocket is fast

Accuracy? Accuracy may be overrated for NPC enemies We want an enjoyable playing experience no warnings sniper attack is realistic but no fun a game has to give the player a chance Built-in inaccuracy many games have enemies deliberately miss on the first couple of shots others build random inaccuracy into all calculations

Force Netwon's law F = m*a In other words acceleration is a function of force and mass Force is also a vector quantity

Example When a bat hits a ball we will want to determine the force imparted to the ball we could simulate this with the mass of the bat and its speed more likely, we would just have a built-in value direction of the force we need to know the angle of the bat when it strikes the ball

More complex motions To handle rotation we also have to worry about torque and angular momentum But for the purposes of this class we will deal only with "particles" game physics is often simplified this way

Example rocket-jumping

Wednesday Finite state machines