CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer

Similar documents
CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer

COMP 175 COMPUTER GRAPHICS. Lecture 04: Transform 1. COMP 175: Computer Graphics February 9, Erik Anderson 04 Transform 1

11.1 Three-Dimensional Coordinate System

Mathematics for 3D Graphics

A DARK GREY P O N T, with a Switch Tail, and a small Star on the Forehead. Any

GG303 Lecture 6 8/27/09 1 SCALARS, VECTORS, AND TENSORS

1 Overview. CS348a: Computer Graphics Handout #8 Geometric Modeling Original Handout #8 Stanford University Thursday, 15 October 1992

In this section, mathematical description of the motion of fluid elements moving in a flow field is

Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems

LECTURE 5, FRIDAY

1.1 Single Variable Calculus versus Multivariable Calculus Rectangular Coordinate Systems... 4

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2011 Lecture 11 September 29, 2011

If the pull is downward (Fig. 1), we want C to point into the page. If the pull is upward (Fig. 2), we want C to point out of the page.

Homogeneous Transformations

Matrix-Vector Products and the Matrix Equation Ax = b

Properties of surfaces II: Second moment of area

Lecture Notes for MATH6106. March 25, 2010

Omm Al-Qura University Dr. Abdulsalam Ai LECTURE OUTLINE CHAPTER 3. Vectors in Physics

Exercise 1: Inertia moment of a simple pendulum

Lecture 8: Coordinate Frames. CITS3003 Graphics & Animation

Classical Mechanics. Luis Anchordoqui

Announcements Wednesday, September 27

MAE 323: Lecture 1. Review

Problem Set 2 Due Tuesday, September 27, ; p : 0. (b) Construct a representation using five d orbitals that sit on the origin as a basis: 1

Vectors for Physics. AP Physics C

MAC Module 5 Vectors in 2-Space and 3-Space II

Linear Algebra & Geometry why is linear algebra useful in computer vision?

LOWELL WEEKLY JOURNAL

MSMS Vectors and Matrices

6. 3D Kinematics DE2-EA 2.1: M4DE. Dr Connor Myant

Homework 1/Solutions. Graded Exercises

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra /34

MAT 419 Lecture Notes Transcribed by Eowyn Cenek 6/1/2012

Problem Set 2 Due Thursday, October 1, & & & & # % (b) Construct a representation using five d orbitals that sit on the origin as a basis:

03 - Basic Linear Algebra and 2D Transformations

Chapter 2. Vectors and Vector Spaces

Bidiagonal pairs, Tridiagonal pairs, Lie algebras, and Quantum Groups

Announcements Monday, September 18

1. Vectors.

ALGEBRAIC GEOMETRY HOMEWORK 3

Detailed objectives are given in each of the sections listed below. 1. Cartesian Space Coordinates. 2. Displacements, Forces, Velocities and Vectors

Algebraic Expressions

12. Stresses and Strains

CHAPTER 4 Stress Transformation

Transformations. Chapter D Transformations Translation

Chapter 2 Math Fundamentals

Polynomials. In many problems, it is useful to write polynomials as products. For example, when solving equations: Example:

Matrix Arithmetic. a 11 a. A + B = + a m1 a mn. + b. a 11 + b 11 a 1n + b 1n = a m1. b m1 b mn. and scalar multiplication for matrices via.

A VERY BRIEF LINEAR ALGEBRA REVIEW for MAP 5485 Introduction to Mathematical Biophysics Fall 2010

LECTURE 10, MONDAY MARCH 15, 2004

x 9 or x > 10 Name: Class: Date: 1 How many natural numbers are between 1.5 and 4.5 on the number line?

Contents. 1 Vectors, Lines and Planes 1. 2 Gaussian Elimination Matrices Vector Spaces and Subspaces 124

Problem 1: (3 points) Recall that the dot product of two vectors in R 3 is

6. SCALARS, VECTORS, AND TENSORS (FOR ORTHOGONAL COORDINATE SYSTEMS)

ARC 341 Structural Analysis II. Lecture 10: MM1.3 MM1.13

Neatest and Promptest Manner. E d i t u r ami rul)lihher. FOIt THE CIIILDIIES'. Trifles.

Review of Coordinate Systems

Department of Physics, Korea University

Linear Algebra & Geometry why is linear algebra useful in computer vision?

CSC 470 Introduction to Computer Graphics. Mathematical Foundations Part 2

Rigid Body Rotation. Speaker: Xiaolei Chen Advisor: Prof. Xiaolin Li. Department of Applied Mathematics and Statistics Stony Brook University (SUNY)

Chapter 1. Vector Analysis

Homogeneous Coordinates

Lesson Rigid Body Dynamics

Stress, Strain, Mohr s Circle

The geometry of least squares

Sec. 1.1: Basics of Vectors

MECH 5312 Solid Mechanics II. Dr. Calvin M. Stewart Department of Mechanical Engineering The University of Texas at El Paso

(A B) 2 + (A B) 2. and factor the result.

Rotational & Rigid-Body Mechanics. Lectures 3+4

Last week we presented the following expression for the angles between two vectors u and v in R n ( ) θ = cos 1 u v

Linear Algebra V = T = ( 4 3 ).

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Linear Algebra 1/33

Lesson 6. Diana Pell. Monday, March 17. Section 4.1: Solve Linear Inequalities Using Properties of Inequality

I&C 6N. Computational Linear Algebra

Math 51, Homework-2 Solutions

The Sphere OPTIONAL - I Vectors and three dimensional Geometry THE SPHERE

Algebraic Expressions and Identities

LOWELL JOURNAL. MUST APOLOGIZE. such communication with the shore as Is m i Boimhle, noewwary and proper for the comfort

Math Exam 2, October 14, 2008

Vector and Affine Math

A geometric interpretation of the homogeneous coordinates is given in the following Figure.

Linear Algebra Homework and Study Guide

(arrows denote positive direction)

Hilbert s Metric and Gromov Hyperbolicity

7a3 2. (c) πa 3 (d) πa 3 (e) πa3

Two Posts to Fill On School Board

A = 3 B = A 1 1 matrix is the same as a number or scalar, 3 = [3].

Unit 2: Lines and Planes in 3 Space. Linear Combinations of Vectors

Vectors and Matrices

Lagrange Multipliers

Lecture 4: Affine Transformations. for Satan himself is transformed into an angel of light. 2 Corinthians 11:14

Intro Vectors 2D implicit curves 2D parametric curves. Graphics 2012/2013, 4th quarter. Lecture 2: vectors, curves, and surfaces

MCE/EEC 647/747: Robot Dynamics and Control. Lecture 2: Rigid Motions and Homogeneous Transformations

Math 302 Test 1 Review

Course 2BA1: Hilary Term 2007 Section 8: Quaternions and Rotations

Chapter 2: Numeric, Cell, and Structure Arrays

Lecture 3: Linear Algebra Review, Part II

HIGHER-ORDER THEORIES

Unit IV State of stress in Three Dimensions

Transcription:

CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Announcements Monday October 3: Discussion Assignment 1 Friday October 7: Assignment 1 due 2

Today s Topics Vectors and matrices Affine transformations Homogeneous coordinates 3

Vectors Give direction and length in 3D Vectors can describe Difference between two 3D points Speed of an object Surface normals (directions perpendicular to surfaces) Normal vector Surface normals Surface 4

Vector arithmetic using coordinates a = ax ay az b = bx by bz a + b = ax + bx ay + by az + bz a b = ax bx ay by az bz ax a= ay az sax sa= say saz where s is a scalar 5

Vector Magnitude The magnitude (length) of a vector is: v 2 = v x 2 + v y 2 + v z 2 v = v x 2 + v y 2 + v z 2 A vector with length of 1.0 is called unit vector We can also normalize a vector to make it a unit vector Unit vectors are often used as surface normals v v 6

Dot Product a b = a i b i a b = a x b x + a y b y + a z b z a b = a b cosθ 7

Angle Between Two Vectors a b = a b cosθ cosθ = a b a b b θ = cos 1 a b a b a 8

Cross Product a b is a vector perpendicular to both a and b, in the direction defined by the right hand rule a b = a b sinθ a b = area of parallelogram ab a b = 0 if aand b are parallel (or one or both degenerate) 9

Cross Product = = 10

Cross Product Calculation = = = 11

Matrices Rectangular array of numbers Square matrix if m = n In graphics almost always: m = n = 3; m = n = 4 12

Matrix Addition 13

Multiplication With Scalar 14

Matrix Multiplication 15

Matrix-Vector Multiplication 16

Identity Matrix 17

Matrix Inverse If a square matrix M is non-singular, there exists a unique inverse M -1 such that 18

Today s Topics Vectors and matrices Affine transformations Homogeneous coordinates 19

Affine Transformations Most important for graphics: rotation, translation, scaling Wolfram MathWorld: An affine transformation is any transformation that preserves collinearity (i.e., all points lying on a line initially still lie on a line after transformation) and ratios of distances (e.g., the midpoint of a line segment remains the midpoint after transformation). Implemented using matrix multiplications 20

Uniform Scale Uniform scale matrix in 2D Analogous in 3D: 0 0 0 0 0 0 21

Non-Uniform Scale Nonuniform scaling matrix in 2D Analogous in 3D: 22

Rotation in 2D Convention: positive angle rotates counterclockwise Rotation matrix 23

Rotation in 3D Rotation around coordinate axes 24

Rotation in 3D Concatenation of rotations around x, y, z axes are called Euler angles Result depends on matrix order! 25

Rotation about an Arbitrary Axis Complicated! Rotate point [x,y,z] about axis [u,v,w] by angle θ: 26

How to rotate around a Pivot Point? Rotation around origin: p = R p Rotation around pivot point: p =? 27

Rotating point p around a pivot point 1. Translation T 2. Rotation R 3. Translation T -1 p = T -1 R T p 28

Concatenating transformations Given a sequence of transformations M 3 M 2 M 1 Note: associativity applies 29

Today s Topics Vectors and matrices Affine transformations Homogeneous coordinates 30

Translation Translation in 2D t x t y Translation matrix T=? = = = =???? 31

Translation Translation in 2D: 3x3 matrix Analogous in 3D: 4x4 matrix 32

Homogeneous Coordinates Basic: a trick to unify/simplify computations. Deeper: projective geometry Interesting mathematical properties Good to know, but less immediately practical We will use some aspect of this when we do perspective projection 33

Homogeneous Coordinates Add an extra component. 1 for a point, 0 for a vector: p = Combine M and d into single 4x4 matrix: p x p y p z 1 And see what happens when we multiply r v = v x v y v z 0 m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 34

Homogeneous Point Transform Transform a point: p x p y p z 1 = m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 p x p y p z 1 = m xx p x + m xy p y + m xz p z + d x m yx p x + m yy p y + m yz p z + d y m zx p x + m zy p y + m zz p z + d z 0 + 0 + 0 + 1 Top three rows are the affine transform! Bottom row stays 1 M p x p y p z + r d 35

Homogeneous Vector Transform Transform a vector: v x v y v z 0 = m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 v x v y v z 0 = m xx v x + m xy v y + m xz v z + 0 m yx v x + m yy v y + m yz v z + 0 m zx v x + m zy v y + m zz v z + 0 0 + 0 + 0 + 0 M v x v y v z Top three rows are the linear transform Displacement d is properly ignored Bottom row stays 0 36

Homogeneous Arithmetic Legal operations always end in 0 or 1! M vector+vector: 0 + M M 0 0 M vector-vector: 0 M M 0 0 scalar*vector: s M M 0 0 M point+vector: 1 + M M 0 1 M point-point: 1 M M 1 0 M point+point: 1 + M M 1 2 scalar*point: s M M 1 s weighted average affine combination of points: 1 M 3 1 + 2 M 3 M 1 1 37

Homogeneous Transforms Rotation, Scale, and Translation of points and vectors unified in a single matrix transformation: p = M p Matrix has the form: Last row always 0,0,0,1 m xx m xy m xz d x m yx m yy m yz d y m zx m zy m zz d z 0 0 0 1 Transforms can be composed by matrix multiplication Same caveat: order of operations is important Same note: transforms operate right-to-left 38