Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.

Slides:



Advertisements
Similar presentations
Homogeneous Transformations CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
UBI 516 Advanced Computer Graphics
Arbitrary Rotations in 3D Lecture 18 Wed, Oct 8, 2003.
Lecture 2: linear algebra, animation basics
12 VECTORS AND THE GEOMETRY OF SPACE.
Geometry (Many slides adapted from Octavia Camps and Amitabh Varshney)
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
Computer Graphics CSC 630 Lecture 2- Linear Algebra.
Midterm Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
Vectors & Matrices CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
CS 450: Computer Graphics 2D TRANSFORMATIONS
CS 450: COMPUTER GRAPHICS 3D TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
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
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Vectors & Matrices CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
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.
Patrick Nichols Thursday, September 18, Linear Algebra Review.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Recap of linear algebra: vectors, matrices, transformations, … Background knowledge for 3DM Marc van Kreveld.
Chapter 4.1 Mathematical Concepts
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
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.
CSCE 552 Spring 2011 Math By Jijun Tang. Layered.
6.837 Linear Algebra Review Patrick Nichols Thursday, September 18, 2003.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Shivkumar Kalyanaraman Rensselaer Polytechnic Institute 1 : “shiv rpi” Linear Algebra A gentle introduction Linear Algebra has become as basic and as applicable.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
6.837 Linear Algebra Review Rob Jagnow Monday, September 20, 2004.
Introduction to Matrices and Vectors Sebastian van Delden USC Upstate
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Matthew Christian. About Me Introduction to Linear Algebra Vectors Matrices Quaternions Links.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
Chun-Yuan Lin Mathematics for Computer Graphics 2015/12/15 1 CG.
Review CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
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.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner Math Basics Week 1, Fri.
Affine Geometry.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
Linear Algebra Review Tuesday, September 7, 2010.
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.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
CA 302 Computer Graphics and Visual Programming
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Lecture 03: Linear Algebra
COMP 175: Computer Graphics February 9, 2016
CSE 411 Computer Graphics Lecture #2 Mathematical Foundations
Linear Algebra A gentle introduction
Math review - scalars, vectors, and matrices
Game Programming Algorithms and Techniques
Presentation transcript:

Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005

Coordinate Systems Right handed coordinate system

Vector Arithmetic

Vector Magnitude The magnitude (length) of a vector is: Unit vector (magnitude=1.0)

Dot Product

Example: Angle Between Vectors How do you find the angle θ between vectors a and b? a b θ

Example: Angle Between Vectors a b θ

Dot Products with Unit Vectors b θ a a·b = 0 0 < a·b < 1 a·b = -1 a·b = 1 -1 < a·b < 0 a·b

Dot Products with Non-Unit Vectors If a and b are arbitrary (non-unit) vectors, then the following are still true: If θ 0 If θ = 90º then a · b = 0 If θ > 90º then a · b < 0

Dot Products with One Unit Vector a u a·u If |u|=1.0 then a·u is the length of the projection of a onto u

Example: Distance to Plane A plane is described by a point p on the plane and a unit normal n. Find the distance from point x to the plane p n x

Example: Distance to Plane The distance is the length of the projection of x-p onto n: p n x x-p

Cross Product

Properties of the Cross Product area of parallelogram ab is perpendicular to both a and b, in the direction defined by the right hand rule if a and b are parallel

Example: Area of a Triangle Find the area of the triangle defined by 3D points a, b, and c a b c

Example: Area of a Triangle b-a c-a a b c

Example: Alignment to Target An object is at position p with a unit length heading of h. We want to rotate it so that the heading is facing some target t. Find a unit axis a and an angle θ to rotate around. p h t

Example: Alignment to Target p h t t-p θ a

Trigonometry 1.0 cos θ sin θ θ cos 2 θ + sin 2 θ = 1

Laws of Sines and Cosines a b c β γ α Law of Sines: Law of Cosines:

Matrices Computer graphics apps commonly use 4x4 homogeneous matrices A rigid 4x4 matrix transformation looks like this: Where a, b, & c are orthogonal unit length vectors representing orientation, and d is a vector representing position

Matrices The right hand column can cause a projection, which we won’t use in character animation, so we leave it as 0,0,0,1 Some books store their matrices in a transposed form. This is fine as long as you remember that:(A·B) T = B T ·A T

Example: Target ‘Lock On’ For an airplane to get a missile locked on, the target must be within a 10 degree cone in front of the plane. If the plane’s matrix is M and the target position is t, find an expression that determines if the plane can get a lock on. a b c d t

Example: Target ‘Lock On’ We want to check the angle between the heading vector (-c) and the vector from d to t: We can speed that up by comparing the cosine instead ( cos(10°)=.985 )

Example: Target ‘Lock On’ We can even speed that up further by removing the division and the square root in the magnitude computation:

Orthonormality If all row vectors and all column vectors of a matrix are unit length, that matrix is said to be orthonormal This also implies that all vectors are perpendicular to each other Orthonormal matrices have some useful mathematical properties, such as: M -1 = M T

Orthonormality If a 4x4 matrix represents a rigid transformation, then the upper 3x3 portion will be orthonormal

Determinants The determinant of a 4x4 matrix with no projection is equal to the determinant of the upper 3x3 portion

Determinants The determinant is a scalar value that represents the volume change that the transformation will cause An orthonormal matrix will have a determinant of 1, but non-orthonormal volume preserving matrices will have a determinant of 1 also A flattened or degenerate matrix has a determinant of 0 A matrix that has been mirrored will have a negative determinant

Transformations To transform a vector v by matrix M: v’=v·M If we want to apply several transformations, we can just multiply by several matrices: v’=(((v·M 1 )·M 2 )·M 3 )·M 4 … Or we can concatenate the transformations into a single matrix: M total =M 1 ·M 2 ·M 3 ·M 4 … v’=v·M total

Matrix Transformations We usually transform vertices from some local space where they are defined into a world space v’ = v·W Once in world space, we can perform operations that require everything to be in the same space (collision detection, high quality lighting…) Then, they are transformed into a camera’s space, and then projected into 2D v’’ = v’·C -1 ·P In simple situations, we can do this all in one step: v’’ = v·W·C -1 ·P

Inversion If M transforms v into world space, then M -1 transforms v’ back into local space

Vector Dot Vector

Vector Dot Matrix

Matrix Dot Matrix

Homogeneous Vectors Technically, homogeneous vectors are 4D vectors that get projected into the 3D w=1 space

Homogeneous Vectors Vectors representing a position in 3D space can just be written as: Vectors representing direction are written: The only time the w coordinate will be something other than 0 or 1 is in the projection phase of rendering, which is not our problem

Position Vector Dot Matrix

v=(.5,.5,0,1) x y Local Space (0,0,0)

Position Vector Dot Matrix v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d Matrix M

Position Vector Dot Matrix v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d v’v’

Direction Vector Dot Matrix

Matrix Dot Matrix (4x4) The row vectors of M’ are the row vectors of M transformed by matrix N Notice that a, b, and c transform as direction vectors and d transforms as a position

Identity Take one more look at the identity matrix It’s a axis lines up with x, b lines up with y, and c lines up with z Position d is at the origin Therefore, it represents a transformation with no rotation or translation

Camera Matrix Think of the camera just like any other object. Just as a chair model has a matrix W that transforms it into world space, the camera matrix C would transform a camera model into world space. We don’t want to transform the camera into world space. Instead, we want to transform the world into the camera’s space, so we use the inverse of C.

Example: Camera ‘Look At’ Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M.

Example: Camera ‘Look At’ Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M. Two possible approaches include: Measure angles and rotate matrix into place Construct a,b,c, & d vectors of M directly

Example: Camera ‘Look At’ Method 1: Measure Angles & Rotate Measure Angles: Tilt angle Heading angle Position Construct matrix by starting with the identity, then apply tilt and heading rotations

Example: Camera ‘Look At’ Method 2: Build Matrix Directly The d vector is just the position of the camera, which is e: The c vector is a unit length vector that points directly behind the viewer:

Example: Camera ‘Look At’ Method 2: Build Matrix Directly The a vector is a unit length vector that points to the right of the viewer. It is perpendicular to the c axis. To keep the camera from rolling, we also want the a vector to lay flat in the xz-plane, perpendicular to the y-axis. Note that a cross product with the y-axis can be optimized as follows:

Example: Camera ‘Look At’ Method 2: Build Matrix Directly The b vector is a unit length vector that points up relative to the viewer. It is perpendicular to the both the c and a axes Note that b does not need to be normalized because it is already unit length. This is because a and c are unit length vectors 90 degrees apart.

Example: Camera ‘Look At’ Method 2: Build Matrix Directly Summary: