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.

Slides:



Advertisements
Similar presentations
Our Friend the Dot Product
Advertisements

Vectors, Points, Lines and Planes Jim Van Verth Lars M. Bishop
2.4. Primitive Tests - Closest point
Chapter 4 Euclidean Vector Spaces
CS 450: COMPUTER GRAPHICS LINEAR ALGEBRA REVIEW SPRING 2015 DR. MICHAEL J. REALE.
Vector Calculus Mengxia Zhu Fall Objective Review vector arithmetic Distinguish points and vectors Relate geometric concepts to their algebraic.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
General Physics (PHYS101)
Mapping: Scaling Rotation Translation Warp
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
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
CS 4731: Computer Graphics Lecture 6: Points, Scalars and Vectors Emmanuel Agu.
Now Playing: My Mathematical Mind Spoon From Gimme Fiction Released May 10, 2005.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
Vectors.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CS 450: Computer Graphics 2D TRANSFORMATIONS
2IV60 Computer Graphics Basic Math for CG
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
Mathematical Fundamentals
CSE 381 – Advanced Game Programming 3D Mathematics
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
UNIVERSITI MALAYSIA PERLIS
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)
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.
Patrick Nichols Thursday, September 18, Linear Algebra Review.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Kansas State University Department of Computing and Information Sciences CIS 736: Computer Graphics Monday, 26 January 2004 William H. Hsu Department of.
Recap of linear algebra: vectors, matrices, transformations, … Background knowledge for 3DM Marc van Kreveld.
Chapter 4.1 Mathematical Concepts
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,
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
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
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
1 Math Review Coordinate systems 2-D, 3-D Vectors Matrices Matrix operations.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Spatial Descriptions and Transformations Sebastian van Delden USC Upstate
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Elementary Linear Algebra Anton & Rorres, 9th Edition
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
CO1301: Games Concepts Dr Nick Mitchell (Room CM 226) Material originally prepared by Gareth Bellaby.
1 Chapter 2: Geometric Camera Models Objective: Formulate the geometrical relationships between image and scene measurements Scene: a 3-D function, g(x,y,z)
Geometric Transformations
1 Graphics CSCI 343, Fall 2015 Lecture 9 Geometric Objects.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
A function is a rule f that associates with each element in a set A one and only one element in a set B. If f associates the element b with the element.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Lecture 03: Linear Algebra
COMP 175: Computer Graphics February 9, 2016
2-D Geometry.
Chapter 3 Linear Algebra
Math review - scalars, vectors, and matrices
Presentation transcript:

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 Extras Talk Outline

Matrix multiplication How to apply dot/cross product Vector normalization Basic understanding of sin/cos Basic idea of what a plane isplane Prerequisites

Formal definition – Input or output from a function of vector algebravector algebra Informal definition – Scalar components representing a direction and magnitude (length) – Vectors have no “location” Vectors

Points and Vectors A point P and Q is related to the vector V by: – P – Q = V This implies that points can be translated by adding vectors

Points and Vectors (2) Lets define an implied point O – O represents the origin Any point P can be expressed with a vector V: – P = O + V Vectors point to points, when relative to the origin!

Standard Euclidean Basis (called E 3 ) – Geometrically the x, y and z axes Euclidean Basis

Given 3 scalars i, j and k, any point in E 3 can be represented Euclidean Basis (2)

Linear Combination Suppose we have a vector V – Consists of 3 scalar values – Below V written in “shorthand” notation

Linear Combination (2) V can be written as a linear combination of E 3 – This is the “longhand” notation of a vector

Basis Matrices E 3 is a basis matrix – Many matrices can represent a basis Any vector can be represented in any basis Note: Different i, j and k values are used on left and right

Rotation Matrices A rotation matrix can rotate vectors – Constructed from 3 orthogonal unit vectors – Can be called an “orthonormal basis” E 3 is a rotation matrix!

Rotation Matrices (2) Rotation matrices consist of an x, y and z axis – Each axis is a vector X y z

Rotation Matrices (3) Multiplying a rotation and a vector rotates the vector This is a linear combination

Dot Product Comes from law of cosineslaw of cosines Full derivation herehere For two vectors u and v:

Shortest Angle Between 2 Vectors Assume u and v are of unit length Result in range of 0, 1 No trig functions required

How Far in a Given Direction? Given point P and vector V – How far along the V direction is P? P V x y

How Far in a Given Direction? (2)

Planes Here’s the 3D plane equation

Planes Here’s the 3D plane equation WAIT A SECOND

Planes Here’s the 3D plane equation WAIT A SECOND THAT’S THE DOT PRODUCT

Planes (2) a, b and c form a vector, called the normal d is magnitude of the vector – Represents distance of plane from origin

Planes (3)

Planes and the Dot Product

Planes and the Dot Product (2) x y P plane

Signed Distance P to Plane

Project P onto Plane x y P plane

Rotation Matrices and Dot Product Given matrices A and B A * B is to dot the rows of A with columns of B Lets assume A and B are rotation matrices

Rotation Matrices and Dot Product (2)

Rotation Matrices and Dot Product (3)

Rotation Matrices and Dot Product (4)

Rotation Matrices and Dot Product (5)

Point in Convex Hull Test if point is inside of a hull – Compute plane equation of hull faces – Compute distance from plane with plane equation – If all distances are negative, point in hull – If any distance is positive, point outside hull Works in any dimension Can by used for basic frustum culling

Point in OBB An OBB is a convex hull! – Hold your horses here… Lets rotate point P into the frame of the OBB – OBB is defined with a rotation matrix, so invert it and multiply P by it – P is now in the basis of the OBB The problem is now point in AABB

Point in Cylinder Rotate cylinder axis to the z axis Ignoring the z axis, cylinder is a circle on the xy plane Test point in circle in 2D – If miss, exit no intersection Get points A and B. A is at top of cylinder, B at bottom See if point’s z component is less than A’s and greater than B’s – Return intersection No intersection

Bumper Car Damage? Two bumper cars hit each other One car takes damage How much damage is dealt, and to whom?

Bumper Car Damage Answer Take vector from one car to another, T Damage dealt: – Abs( Dot( velocity, T ) * collisionDamage )

ndygaul.net/20 14/07/23/dista nce-point-to- line-segment/

Visualization in 2D C P

Cross Product Operation between vectors Produces a vector orthogonal to both input vectors

Cross Product Handedness

Cross Product Details 20px-Cross_product.gif

Plane Equation from 3 Points Given three points A, B and C Calculate normal with: Cross( C – A, B – A ) Normalize normal Compute offset d: dot( normal, A (or B or C) )

Compute distance A to Plane: da Compute distance B to Plane: db If da * db < 0 – Intersection = A + (da / (da – db)) * (B – A) Else – No intersection

P normal

Affine Transformations Given matrix A, point x and vector b An affine transformation is of the form: – Ax + b

Affine Transformations Given 3x3 matrix A, point x and vector b An affine transformation is of the form: – Ax + b With a 4x4 matrix we can represent Ax + b in block formation:

Translation Construct an affine transformation such that when multiplied with a point, translates the point by the vector b I is the identity matrix, and means no rotation (or scaling) occurs

Translation (2) The 1 is important, it means it is a point If we had a zero here b wouldn’t affect x

Translation (3) Proof that translation doesn’t affect vectors: – Translate from P to Q by T P – Q = T = (P + T) – (Q + T) = (P – Q) + (T – T) = P – Q

Rotation Orthonormal basis into the top left of an affine transformation, without any translation vector:

Scaling Given scaling vector S Take the matrix A Scale A’s x axis’ x component by S 0 Scale A’s y axis’ y component by S 1 Scale A’s z axis’ z component by S 2

Scaling (2)

Camera - LookAt

Camera – LookAt (2) Won’t work when player tries to look straight up or down – Parallel vectors crossed result in the zero vector Possible solutions: – Snap player’s view away from up/down – Use an if statement and cross with a different up vector – More solutions exist!

Barycentric Coordinates Slightly out of scope of this presentation See Erin Catto’s GDC 2010 lecture Idea: – Like a linear combination, try affine combinations of points Useful for: – Voronoi region identification, collision detection, certain graphics or shader effects