Vectors, Points, Lines and Planes Jim Van Verth Lars M. Bishop

Slides:



Advertisements
Similar presentations
Our Friend the Dot Product
Advertisements

Linear Transformations and Matrices Jim Van Verth Lars M. Bishop
CS 450: COMPUTER GRAPHICS LINEAR ALGEBRA REVIEW SPRING 2015 DR. MICHAEL J. REALE.
3D Geometry for Computer Graphics
Vector Calculus Mengxia Zhu Fall Objective Review vector arithmetic Distinguish points and vectors Relate geometric concepts to their algebraic.
Math Review Guest Lecturer: Michiel van de Panne Week 1, Wed Jan 9
Math Foundations of CG Math 1 Hofstra University.
Computer Graphics Recitation 5.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Computer Graphics CSC 630 Lecture 2- Linear Algebra.
Vectors.
Scalar and Vector Fields
2IV60 Computer Graphics Basic Math for CG
Length and Dot Product in R n Notes: is called a unit vector. Notes: The length of a vector is also called its norm. Chapter 5 Inner Product Spaces.
Geometric Intuition Randy Gaul. Vectors, Points and Basis Matrices Rotation Matrices Dot product and how it’s useful Cross product and how it’s useful.
Mathematical Fundamentals
Chapter 9-Vectors Calculus, 2ed, by Blank & Krantz, Copyright 2011 by John Wiley & Sons, Inc, All Rights Reserved.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Math Primer for CG Ref: Interactive Computer Graphics, Chap. 4, E. Angel.
Elementary Linear Algebra Howard Anton Copyright © 2010 by John Wiley & Sons, Inc. All rights reserved. Chapter 3.
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
1 February 24 Matrices 3.2 Matrices; Row reduction Standard form of a set of linear equations: Chapter 3 Linear Algebra Matrix of coefficients: Augmented.
Recap of linear algebra: vectors, matrices, transformations, … Background knowledge for 3DM Marc van Kreveld.
Vectors & Matrices Marq Singer
7.1 Scalars and vectors Scalar: a quantity specified by its magnitude, for example: temperature, time, mass, and density Chapter 7 Vector algebra Vector:
1.1 – 1.2 The Geometry and Algebra of Vectors.  Quantities that have magnitude but not direction are called scalars. Ex: Area, volume, temperature, time,
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.
Elementary Linear Algebra Anton & Rorres, 9th Edition
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Orthogonal Functions and Fourier Series.
Mathematics for Graphics. 1 Objectives Introduce the elements of geometry  Scalars  Vectors  Points Develop mathematical operations among them in a.
Vectors CHAPTER 7. Ch7_2 Contents  7.1 Vectors in 2-Space 7.1 Vectors in 2-Space  7.2 Vectors in 3-Space 7.2 Vectors in 3-Space  7.3 Dot Product 7.3.
Elementary Linear Algebra Anton & Rorres, 9th Edition
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
VECTORS (Ch. 12) Vectors in the plane Definition: A vector v in the Cartesian plane is an ordered pair of real numbers:  a,b . We write v =  a,b  and.
Basic Entities Scalars - real numbers sizes/lengths/angles Vectors - typically 2D, 3D, 4D directions Points - typically 2D, 3D, 4D locations Basic Geometry.
1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Math Basics Week 1, Fri.
Basic Theory (for curve 01). 1.1 Points and Vectors  Real life methods for constructing curves and surfaces often start with points and vectors, which.
Computer Graphics I, Fall 2010 Geometry.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Math Review Week 1, Fri.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Analytic geometry refreshment Szirmay-Kalos László.
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Math /7.5 – Vectors 1. Suppose a car is heading NE (northeast) at 60 mph. We can use a vector to help draw a picture (see right). 2.
Vector 2.
CA 302 Computer Graphics and Visual Programming
Spaces.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Math Fundamentals Maths revisit.
Elementary Linear Algebra
Outline Addition and subtraction of vectors Vector decomposition
Contents 7.1 Vectors in 2-Space 7.2 Vectors in 3-Space 7.3 Dot Product
CSC461: Lecture 12 Geometry Objectives
Lecture 03: Linear Algebra
Joshua Barczak CMSC 435 UMBC
Chapter 3 Vectors.
Introduction to Computer Graphics with WebGL
Vectors and the Geometry
CSE 411 Computer Graphics Lecture #2 Mathematical Foundations
Math review - scalars, vectors, and matrices
Game Programming Algorithms and Techniques
CHAPTER 3 VECTORS NHAA/IMK/UNIMAP.
Presentation transcript:

Vectors, Points, Lines and Planes Jim Van Verth Lars M. Bishop

Essential Math for Games Geometric Representation Problem Represent geometric data in computer? Solution Vectors and points Can represent most abstract objects as combinations of these E.g. lines, planes, polygons

Essential Math for Games What Is a Vector? Geometric object with two properties direction length (if length is 1, is unit vector) Graphically represented by

Essential Math for Games Scale Graphically change length of vector v by

Essential Math for Games Addition Graphically put tail of second vector at head of first draw new vector from tail of first to head of second b a a + b

Essential Math for Games Algebraic Vectors Algebraically, vectors are more than this Any entity that meets certain rules (lies in vector space) can be called vector Ex: Matrices, quaternions, fixed length polynomials Mostly mean geometric vectors, however

Essential Math for Games Vector Space Set of vectors related by +,· Meet rules v + w = w + v (commutative +) (v + w) + u = v + (w + u) (associative +) v + 0 = v(identity +) v + (-v) = 0(inverse +) ( ) v = ( v)(associative ·) ( + )v = v + v(distributive ·) (v + w) = v + w (distributive ·)

Essential Math for Games Number Spaces Cardinal – Positive numbers, no fractions Integer – Pos., neg., zero, no fractions Rational – Fractions (ratios of integers) Irrational – Non-repeating decimals (, e ) Real – Rationals+irrationals Complex – Real + multiple of -1 a+bi

Essential Math for Games Real Vector Spaces Usually only work in these R n is an n-dimensional system of real numbers Represented as ordered list of real numbers (a 1,…,a n ) R 3 is the 3D world, R 2 is the 2D world

Essential Math for Games Linear Combination Combine set of n vectors using addition and scalar multiplication v = 1 v v 2 + … + n v n Collection of all possible linear combinations for given v 1 … v n is called a span Linear combination of 2 perpendicular vectors span a plane

Essential Math for Games Linear Dependence A system of vectors v 1, …,v n is called linearly dependant if for at least one v i v i = 1 v 1 +…+ i-1 v i-1 + i+1 v i+1 +…+ n v n Otherwise, linearly independent Two linearly dependant vectors are said to be collinear I.e. w =. v I.e. they point the same direction

Essential Math for Games Linear Dependence Example Center vector can be constructed from outer vectors Vector Prerequisites

Essential Math for Games Vector Basis Ordered set of n lin. ind. vectors = { v 1, v 2, …, v n } Span n-dimensional space Represent any vector as linear combo v = 1 v v 2 + … + n v n Or just components v = ( 1, 2, …, n )

Essential Math for Games Vector Representation 3D vector v represented by (x, y, z) Use standard basis { i, j, k } Unit length, perpendicular (orthonormal) v = xi + yj + zk Number of units in each axis direction v1v1 v3v3 v2v2

Essential Math for Games Vector Operations Addition: +,- Scale: · Length: || v || Normalize:

Essential Math for Games Addition Add a to b b a a + b

Essential Math for Games Scalar Multiplication change length of vector v by

Essential Math for Games Length ||v|| gives length (or Euclidean norm) of v if ||v|| is 1, v is called unit vector usually compare length squared Normalize v scaled by 1/|| v || gives unit vector

Essential Math for Games Vector Operations Games tend to use most of the common vector operations Addition, Subtraction Scalar multiplication Two others are extremely common: Dot product Cross product

Essential Math for Games Dot product Also called inner product, scalar product a b

Essential Math for Games Dot Product: Uses a a equals ||a|| 2 can test for collinear vectors if a and b collinear & unit length, | a b | ~ 1 Problems w/floating point, though can test angle/visibility a b > 0 if angle < 90° a b = 0 if angle = 90° (orthogonal) a b 90°

Essential Math for Games Dot Product: Example Suppose have view vector v and vector t to object in scene ( t = o - e ) If v t < 0, object behind us, dont draw v t o e

Essential Math for Games Dot Product: Uses Projection of a onto b is a b

Essential Math for Games Dot Product: Uses Example: break a into components collinear and perpendicular to b a b

Essential Math for Games Cross Product Cross product: definition returns vector perpendicular to a and b right hand rule length = area of parallelogram a b c

Essential Math for Games Cross Product: Uses gives a vector perpendicular to the other two! || a b || = ||a|| ||b|| sin( ) can test collinearity ||a b|| = 0 if a and b are collinear Better than dot – dont have to be normalized

Essential Math for Games Other Operations Several other vector operations used in games may be new to you: Scalar Triple Product Vector Triple Product These are often used directly or indirectly in game code, as well see

Essential Math for Games Scalar Triple Product Dot product/cross product combo Volume of parallelpiped Test rotation direction Check sign w v u

Essential Math for Games Triple Scalar Product: Example Current velocity v, desired direction d on xy plane Take If > 0, turn left, if < 0, turn right v d v d d v

Essential Math for Games Vector Triple Product Two cross products Useful for building orthonormal basis Compute and normalize:

Essential Math for Games Points Points are positions in space anchored to origin of coordinate system Vectors just direction and length free- floating in space Cant do all vector operations on points But generally use one class in library

Essential Math for Games Two points related by a vector (Q - P) = v P + v = Q Point-Vector Relations v Q P

Essential Math for Games Vector, point related by origin (P - O) = v O + v = P Vector space, origin, relation between them make an affine space Affine Space v P O e3e3 e2e2 e1e1

Essential Math for Games Cartesian Frame Basis vectors {i, j, k}, origin (0,0,0) 3D point P represented by (p x, p y, p z ) Number of units in each axis direction relative to origin o pxpx pzpz pypy

Essential Math for Games Affine Combination Like linear combination, but with points P = a 1 P 1 + a 2 P 2 + … + a n P n a 1,…,a n barycentric coord., add to 1 Same as point + linear combination P = P 1 + a 2 (P 2 -P 1 ) + … + a n (P n -P 1 ) If vectors ( P 2 -P 1 ), …, (P n -P 1 ) are linearly independent, {P 1, …, P n } called a simplex (think of as affine basis)

Essential Math for Games Convex Combination Affine combination with a 1,…,a n between 0 and 1 Spans smallest convex shape surrounding points – convex hull Example: triangle

Essential Math for Games Points, Vectors in Games Points used for models, position vertices of a triangle Vectors used for velocity, acceleration indicate difference between points, vectors

Essential Math for Games Parameterized Lines Can represent line with point and vector P + tv Can also represent an interpolation from P to Q P + t(Q-P) Also written as (1-t)P + tQ P v Q

Essential Math for Games Planes 2 non-collinear vectors span a plane Cross product is normal n to plane n

Essential Math for Games Planes Defined by normal n = (A, B, C) point on plane P0 Plane equation Ax+By+Cz+D = 0 D=-(A·P0 x + B·P0 y + C·P0 z )

Essential Math for Games Planes Can use plane equation to test locality of point If n is normalized, gives distance to plane n Ax+By+Cz+D > 0 Ax+By+Cz+D = 0 Ax+By+Cz+D < 0

Essential Math for Games References Anton, Howard and Chris Rorres, Elementary Linear Algebra, 7 th Ed, Wiley & Sons, Axler, Sheldon, Linear Algebra Done Right, Springer Verlag, Blinn, Jim, Notation, Notation, Notation, Morgan Kaufmann, 2002.